<!--
 * @Author: hua
 * @Date: 2020-07-17 17:03:32
 * @description: 
 * @LastEditors: hua
 * @LastEditTime: 2020-09-30 14:57:34
--> 
<template>
  <div id="app">
    <!-- 固定测试/生产提醒 -->
    <el-button v-if="envirnoment=='development'" type="success" circle style="position: absolute;bottom:40px;right:20px;z-index:100">dev</el-button>
    <el-button v-if="envirnoment=='production'" type="warning" circle style="position: absolute;bottom:40px;right:20px;z-index:100">pro</el-button>
    <headerTop></headerTop>
    <router-view></router-view>
  </div>
</template>

<script>
const ipcRenderer = require("electron").ipcRenderer;
import headerTop from "@/components/header/header";
export default {
  name: "App",
  components: { headerTop },
   data() {
    return {
      envirnoment:"development"
    };
  },
  mounted() {
    if(process.env.NODE_ENV === "development"){
      this.envirnoment = "development"
    }else{
      this.envirnoment = "production"
    }
    window.firstContentLock = false;
    window.bindInfo = { imei: "" };
    window.msg = "";
    //初始化串口信息
    window.serialport = require("serialport");
    window.port = null;
    window.comName = null;
    window.cardData = { card: "", cardData: "" };
    /* document.getElementById("app").style.height =
      document.body.clientHeight - 33 + "px";
    window.onresize = function() {
      let app = document.getElementById("app");
      if (app) {
        app.style.height = document.body.clientHeight - 33 + "px";
      }
    }; */

    //使用ipcRenderer与主进程通信，并获取返回值
    ipcRenderer.send("getPrinterList");
    //监听主线程获取到打印机列表后的回调
    ipcRenderer.once("getPrinterList", (event, data) => {
      //data就是打印机列表
      console.log(data);
    });
  },
};
</script>
<style lang="scss">
@import "./styles/index.scss"; // 全局自定义的css样式
#app {
  height: 100%;
  width: 100%;
  overflow: hidden;
}
.el-card__header{
  padding:0px!important;
}
.el-card__body{
  padding:10px 16px 10px 16px!important;
}
</style>
